import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import SingerPlay from './views/SingerPlay.vue'
import Enter from './views/Enter.vue'
Vue.use(Router)



const router = new Router({
    routes: [
        {
            path: '/',
            name: 'enter',
            component: Enter
        },
        {
            path: '/home/:id',
            name: 'home',
            component: Home
        },
        {
            path: '/about',
            name: 'about',
            // route level code-splitting
            // this generates a separate chunk (about.[hash].js) for this route
            // which is lazy-loaded when the route is visited.
            component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
        },
        //歌曲播放
        {
            path: '/singerplayer/:id',
            name: 'singerplayer',
            component: SingerPlay
        },
        //歌手介绍
        {
            path: '/introductionsingers/:singerId',
            name: 'introductionsingers',
            component: () => import( './views/IntroductionSingers.vue')
        }

    ]


})


router.afterEach((to, from, next) => {
    window.scrollTo(0, 0)
});


export default router;
